package com.bb;

public class Cow {
    private double weight;
    public Cow() {};
    public Cow(double weight) {
        this.weight = weight;
    }
    // 定义一个非静态内部类
    private class CrowLeg {
        // 非静态类内部的两个属性
        private double length;
        private String color;

        public CrowLeg() {
        }

        public CrowLeg(double length, String color) {
            this.length = length;
            this.color = color;
        }

        public double getLength() {
            return length;
        }

        public void setLength(double length) {
            this.length = length;
        }

        public String getColor() {
            return color;
        }

        public void setColor(String color) {
            this.color = color;
        }

        public void info() {
            System.out.println("当前牛腿颜色是：" + color + ",高：" + length);
            // 直接访问外部类的private属性： weight
            System.out.println("本牛腿所在奶牛重:" + weight);
        }
    }

    public void test() {
        CrowLeg c1 = new CrowLeg(1.12, "黑白相间");
        c1.info();
    }

    public static void main(String[] args) {
        Cow cow = new Cow(378.9);
        cow.test();
    }
}
